Encoder unit for providing to a servo motor control unit position data which is adjusted to account for processing delays

ABSTRACT

In an encoder unit for interpolating analog signals such as sine waves and triangular waves to obtain higher resolution or absolute values through A/D conversion and arithmetic processing, a delay time of data which is caused by A/D conversion and arithmetic processing time is eliminated to prevent deterioration of control performance. A storage unit for holding detected angular data and an output compensation unit for compensating the delay time are provided and a position change occurring during the delay time is predicted by the output compensation unit from angular data obtained from current and previous sampling cycles, and the delay time is compensated by adding the predicted position change to the current sampling data. Deterioration of the control performance can be prevented and inexpensive low-speed A/D converter and arithmetic processor can be used, and, therefore, required costs can be reduced.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to an encoder unit for detecting aposition on a machine tool or the like and a servo motor control unitfor controlling a servo motor according to position data obtained fromthe encoder unit.

2. Description of Prior Art

For the purpose of providing the encoder unit with high resolution orobtaining an absolute value encoder unit, a method as, for example,disclosed in the Patent Publication Gazette HEI. 5-65827, is known bywhich analog signals such as sine waves and triangular waves to beoutputted in accordance with the rotation angle and analog signalshaving a specified phase difference from the analog signals are A/Dconverted and the result of conversion is interpolated by arithmeticoperation. FIG. 22 is a configuration diagram of a conventional encodercontrol apparatus according to the above-described method. In FIG. 22,reference numeral 1 denotes an encoder unit which is installed on aservo motor 3 or a moving part of a machine. Motor drive unit 2 controlsthe servo motor 3 with a position command from an external source and anoutput of the encoder unit 1.

The following describes the details of the encoder unit 1 and motordrive unit 2 of FIG. 22. A quantity of light emitted from LED 4A toreach light receiving devices 6A and 6B such as photo diodes and phototransistors is changed by a shield plate 5 installed on a motor shaft ora moving part of a machine, and the light receiving devices 6A and 6Bgenerate signals proportional to the quantity of light. These signalsare analog signals such as sine waves or triangular waves which arephase-offset by 90° relative to each other. These analog signals aresimultaneously held by sample-and-hold circuits 7A and 7B and enteredinto A/D converters 8A and 8B. Data digitized by the A/D converter isconverted to position data by an arithmetic unit 9 and outputted to themotor drive unit 2. The arithmetic unit 9 comprises a divider and a ROMtable.

Operation of the motor drive unit 2 is described below. A subtractor 12outputs a difference between a position command and an output θ(Tn) ofthe encoder unit 1 and a position control means 13 generates a speedcommand value in accordance with this difference. A subtractor 14outputs a difference between the speed command value and the speedfeedback value obtained by differentiating θ(T_(n)) in a differentiator19 and a speed control means 15 generates a current command value inaccordance with this difference. A subtractor 16 outputs a differencebetween the current command value and the current feedback value, and acurrent control means 17 generates a voltage command value in accordancewith this difference. A 3-phase PWM voltage generating means 18 outputsa 3-phase voltage in response to the voltage command and controls theservo motor which is a synchronous motor. Specifically, the 3-phase PWMvoltage generating means determines a magnetic pole position of themotor from the output θ(T_(n)) of the encoder, and outputs a 3-phasevoltage in accordance with the current magnetic pole position. In thecurrent feedback loop, the 3-phase alternating current is detected bythe current detectors 31A and 31B, converted to a torque componentcurrent at a 3-phase AC→d-q axis converter 20 and used for controllingthe current. In this case, the 3-phase AC→d-q axis converter 20determines the magnetic pole position of the motor from the outputθ(T_(n)) of the encoder and carries out conversion in accordance withthe current magnetic pole position.

A data processing timing chart of the conventional encoder unit is shownin FIG. 23. Holding by sample-and-hold circuits 7A and 7B is generallycyclic holding according to a request signal given by the motor driveunit 2. When a signal is held, the A/D converters 8A and 8B start A/Dconversion. After completion of A/D conversion, the data isarithmetically processed by the arithmetic unit 9 and angular dataθ(T_(n)) at time T_(n) is outputted at time T_(n) +T_(d). The motordrive unit 2 executes the control from time T_(n) +T_(d). This angulardata is outputted as serial signals in most cases.

As described above, a large delay time is taken in A/D conversion,arithmetic processing and serial communication from holding of analogsignals to data transfer to the motor drive unit 2.

As a speed detection method with compensation of the delay time, amethod as disclosed, for example, in Patent Application DisclosureGazette SHO. 62-260574 is known to predict V.sub.(n+1) from a previouslydetected speed V.sub.(n-1) and a currently detected speed V_(n). In thiscase, the relationship is represented by the following arithmeticequation:

    V.sub.(n+1) =2V.sub.(n) -V.sub.(n-1)

This compensation method is intended to implement linear extrapolationfor linear increase or decrease shown in FIG. 24. A concept diagram forapplying this compensation method to position detection of the encoderunit to predict and compensate the sampling cycle T0 (where T0=T_(n)-T_(n-1)) and the delay time T_(d) is shown in FIG. 26 and a blockdiagram of the compensation unit is shown in FIG. 28.

A method for curvilinear extrapolation based on assumption that avariation component in the sampling cycle increases or decreases at aspecified increment or decrement as shown in FIG. 25 is also easilyconsidered. In this case, the relationship is represented by thefollowing arithmetic equation:

    V.sub.(n+1) =3V.sub.(n) -3V.sub.(n-1) +V.sub.(n-2)

A concept diagram for applying this method to position detection of theencoder unit to predict and compensate the sampling cycle T0 and thedelay time T_(d) is shown in FIG. 27 and a block diagram of thecompensation unit is shown in FIG. 29.

Since the conventional encoder unit is constructed as described above, adelay time occurs before the position data is outputted in response to arequest from a servo amplifier. The position data outputted does nottherefore coincide with a true angle and includes a delay time. Themotor drive unit 2 controls the motor according to the position datawith such delay. Though the position control means 13 generally has hada low loop gain of the control system and is rarely affected by thedelay time, the speed control means 15 has a high loop gain and isrequired to provide high frequency responses; thus, the delay time inthe encoder output, which causes a same delay time in speed control,results in deterioration of the control performance.

When a synchronous motor is used as the servo motor, the magnetic poleposition data of the motor is required for the 3-phase PWM voltagegenerating means 18 and the 3-phase AC→d-q axis converter 20 asdescribed above. However, the problem exists that, if the encoder outputdata includes a delay, an error of magnetic pole detection, particularlyin high speed rotation of the motor, becomes large and the motor outputtorque is greatly reduced.

The above problems can be relieved by speeding up A/D conversion andarithmetic operation. However, this approach is disadvantageous in thata high speed A/D converter and an arithmetic processing unit, which arevery expensive, must be used.

Additionally, the reliability of high speed serial communication islimited.

The following describes the problems resulting from the use of thecompensation method shown in FIGS. 28 and 29 for predicting andcalculating a position change occurring during the detection delay. Forexample, as shown in FIGS. 30 and 31, it is assumed that the motor staysat a position θ0 nearby the border line of 80 and 81 until time T_(n-1),then moves into the area of the position 81 across the border line attime T_(n), and returns to the original position at time T₊₁. In thiscase, (delay time T_(d))=(sampling cycle T0) is assumed for convenience.In case of compensation by linear extrapolation, equations are asfollows.

    θ(T.sub.n+1)=2θ(T.sub.n)-θ(T.sub.n-1)=2

    θ(T.sub.n+2)=2θ(T.sub.n+1)-θ(T.sub.n)=-1

The encoder output fluctuates in a width of three pulses despite that anactual behavior of the motor is as small as less than the minimum unitof detection. This fluctuation is fed back to the motor drive unit 2 toresult in increasing of vibration when the motor is stopped.

In case of compensation by curvilinear extrapolation shown in FIG. 29,equations are as given below.

    θ(T.sub.n+1)=3θ(T.sub.n)-3θ(T.sub.n-1)+θ(T.sub.n-2)=3

    θ(T.sub.n+2)=3θ(T.sub.n+1)-θ(T.sub.n)=-3

As shown in FIG. 32, the encoder output fluctuates in a width of sixpulses to result in further increasing vibration when the motor isstopped.

The position of the motor cannot be smoothly detected even in low speedmovement of the motor for a relation to the minimum unit of detection ofthe encoder unit and, if compensation shown in FIGS. 28 and 29 iscarried out, an error less than the minimum unit of detection isamplified and outputted to increase unevenness of rotation. Thisphenomenon is shown in FIG. 33. In FIG. 33, an operation foraccelerating in a reverse direction after the speed has been reduced tozero is shown as an example. Vertical scales denote the detectionborders of the encoder and the horizontal scales indicate the samplingtime.

As described above, the conventional method for predicting andcompensating the delay time cannot be directly applied to the encoderunit.

An object of the present invention is to solve the aforementionedproblems by providing: an encoder unit capable of outputting positiondata free from time delay and performing accurate position detection;and a servo motor control unit capable of very precisely controlling theservo motor according to position data received from the encoder unit.

SUMMARY OF THE INVENTION

In order to overcome the aforementioned problems, the servo motorcontrol unit described herein comprises an encoder unit which includesencoder output compensating means which uses the position data obtainedfrom current sampling and previous samplings to predict a positionchange of a detected object (e.g., a servo motor) during a delay timerequired to output position data from sampled analog detection signals.The encoder output compensating means outputs a predicted positionchange that occurs during the delay time as well as predicted positiondata obtained by adding the predicted position change to the currentlysampled position data.

The servo motor control unit further comprises a motor drive unitcomprising: position control means for generating a speed command valuein response to a difference between a position command and the currentlysampled position data; speed control means for generating a currentcommand value in response to a difference between the speed commandvalue and a speed feedback value obtained from the predicted positionchanged; conversion means for converting a 3-phase alternating currentdetected from the servo motor to a torque component current andperforming conversion in accordance with a current magnetic poleposition where the servo motor is a synchronous motor; current controlmeans for generating a voltage command value in response to a differencebetween the current command value and a current feedback value generatedby the conversion means; and voltage generating means for outputting a3-phase voltage in response to a current magnetic pole position from thepredicted position data.

According to a first embodiment, the encoder output compensation meanscalculates the predicted position change that occurs during the delaytime required for sampling analog signals and outputting position data,by selecting the smaller of: the absolute value of the position changein the current sampling cycle; and the absolute value of the positionchange in the preceding sampling cycle, using the assumption that theposition change during the sampling cycle changes linearly orcurvilinearly with respect to the position in accordance with theselected position change, and for compensating output position data.

According to a second embodiment, the encoder output compensation meanscalculates the predicted position change that occurs during the delaytime required for sampling analog signals and outputting position data,by selecting: 1) the smaller of the absolute value of the positionchange in the current sampling cycle, and the absolute value of theposition change in the preceding sampling cycle; and 2) the smaller of:a difference between the .position change in the current sampling cycleand the position change in the preceding sampling cycle, and adifference between the position change in the preceding sampling cycleand the position change in the sampling cycle occurring prior to thepreceding sampling cycle, and using the assumption that the positionchange in the sampling cycle changes linearly or curvilinearly inaccordance with a sum of the selected position change and the selectedposition change difference.

According to a third embodiment, the encoder output compensation meanscalculates the predicted position change that occurs during the delaytime required for sampling analog signals and outputting position data,by assuming that the position change during the sampling cycle changeslinearly or curvilinearly in accordance with a mean value of theposition change during the current sampling cycle and the positionchange during the preceding sampling cycle.

According to a fourth embodiment, the encoder output compensation meanscalculates the predicted position change that occurs during the delaytime required for sampling analog signals and outputting position data,by assuming that the position change during the sampling cycle changeslinearly or curvilinearly in accordance with a sum of a mean value ofthe position changes obtained from the position change in the currentsampling cycle and the position change in the sampling cycle occurringprior to the preceding sampling cycle and a mean value of thedifferences between the position change in the preceding sampling cycleand the position change in the sampling cycle occurring prior to thepreceding sampling cycle.

According to a fifth embodiment, the encoder output compensating meanscalculates a predicted position change from position data obtained inthe current sampling and preceding samplings, and includes a variablemultiplier for reducing the predicted position change when the positionchange in the current sampling cycle is small.

According to a sixth embodiment, the encoder output compensation meansevaluates in advance a relationship between a current value to beoutputted from the motor drive unit and a degree of variation in theposition change in the sampling cycle, and calculates the predictedposition change that occurs during the delay time, based upon theevaluated relationship and the currently sampled position data.

According to a seventh embodiment, there is provided: signal generatingmeans for generating analog signals corresponding to a rotation angle ofa revolving shaft; A/D conversion means for sampling the analog signalsand converting them to digital data; arithmetic operation means forobtaining a rotation angle of the revolving shaft from converted digitaldata; pulse signal generating means for generating pulses the phases ofwhich are phase-offset by 90° relative to each other; a counter forcounting the number of said pulses; and encoder output compensationmeans for outputting a sum of 1) a rotation angle measured by thecounter from sampling of the analog signals to completion of calculationof the rotation angle, and 2) a rotation angle calculated from theanalog signals as a current angle.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing the encoder unit and the servo motorcontrol unit according to the present invention.

FIG. 2 is a timing chart showing the operation of the encoder unit shownin FIG. 1.

FIG. 3 is an illustration showing the operation of the storage unit ofthe encoder unit according to the present invention.

FIG. 4 is a block diagram showing the encoder unit and the servo motorcontrol unit according to the first embodiment of the present invention.

FIG. 5 is a block diagram showing the output compensation unit of theencoder unit according to the first embodiment of the present invention.

FIG. 6 is a block diagram showing the output compensation unit of theencoder unit according to the second embodiment of the presentinvention.

FIG. 7 is a flow chart showing the operation of switches of the encoderunit according to the present invention.

FIG. 8 is a block diagram showing the output compensation unit of theencoder unit according to the third embodiment of the present invention.

FIG. 9 is a block diagram showing the output compensation unit of theencoder unit according to the fourth embodiment of the presentinvention.

FIG. 10 is a graph showing the operation at a position nearby thedetection border of the output compensation unit of the encoder unitaccording to the first and third embodiments of the present invention.

FIG. 11 is a graph showing the operation at a position nearby thedetection border of the output compensation unit of the encoder unitaccording to the fourth embodiment of the present invention.

FIG. 12 is a graph showing the operation of the output compensation unitof the encoder unit according to first and second embodiments of thepresent invention.

FIG. 13 is a graph showing the operation of the output compensation unitof the encoder unit according to the third and fourth embodiments of thepresent invention.

FIG. 14 is a block diagram showing the output compensation unit of theencoder unit according to the fifth embodiment of the present invention.

FIG. 15 is a graph showing an operation example of the variablemultiplier of the output compensation unit shown in FIG. 14.

FIG. 16 is a graph showing another operation example of the variablemultiplier of the output compensation unit shown in FIG. 14.

FIG. 17 is a block diagram showing the encoder unit and the servo motorcontrol unit according to the sixth embodiment of the present invention.

FIG. 18 is a graph illustrating the function estimation unit of theencoder unit shown in FIG. 17.

FIG. 19 is a block diagram showing the encoder unit according to theseventh embodiment of the present invention.

FIG. 20 is an illustration showing the shield plate of the encoder unitshown in FIG. 19.

FIG. 21 is a timing chart showing the operation of the encoder unitshown in FIG. 19.

FIG. 22 is a block diagram showing the conventional encoder unit andservo motor control unit.

FIG. 23 is a timing chart showing the operation of the conventionalencoder unit.

FIG. 24 is a graph illustrating the conventional example of delay timecompensation in speed detection.

FIG. 25 is a graph illustrating the conventional example of delay timecompensation in speed detection.

FIG. 26 is a graph illustrating the compensation operation when theconventional delay time compensation applies to the encoder unit.

FIG. 27 is a graph illustrating the compensation operation when theconventional delay time compensation applies to the encoder unit.

FIG. 28 is a block diagram showing the configuration when theconventional delay time compensation applies to the encoder unit.

FIG. 29 is a block diagram showing the configuration when theconventional delay time compensation applies to the encoder unit.

FIG. 30 is a diagram illustrating the problem in the conventional delaytime compensation.

FIG. 31 is a graph illustrating the problem in the conventional delaytime compensation.

FIG. 32 is a graph illustrating the problem in the conventional delaytime compensation.

FIG. 33 is a graph illustrating the operation of the conventional delaytime compensation.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

The embodiments of the present invention are described in detail below.FIG. 1 is a configuration of an encoder unit and a servo motor controlunit according to the present invention. In FIG. 1, those elementscorresponding to the same elements shown in FIG. 22 are given the samereference numerals and the description is omitted. An output θ(T_(n)) ofan arithmetic unit 9 (which is arithmetic operation means) is outputtedto a motor drive unit 2 and an encoder output compensation unit(hereafter referred to as the output compensation unit 11 which isoutput compensation means) and is stored in a storage unit 10. Thestorage unit 10 stores the n latest position data as shown in FIG. 3 andoutputs stored position data according to a request of the outputcompensation unit 11. The output compensation unit 11 outputs predictedposition data θ(T_(n) +T_(d)) at a time T_(n) +T_(d), which iscompensated for a delay equal to a delay time T_(d) in arithmeticoperation and a predicted position change Δθ(T_(n) +T_(d)) in thesampling cycle at time T_(n) +T_(d), based upon past sampling positiondata θ(T_(n-1)), θ(T_(n-2)), . . . and the current position dataθ(T_(n)). The output compensation unit 11 is a delay time compensationunit of the type shown in FIGS. 28 and 29 or an output compensation unitshown in the first through sixth embodiments.

A loop gain in the position control is generally small (approximately 30rad/s) and rarely is affected by a time delay of detection. Ifinaccurate data is fed back as in the description of conventional delaytime compensation, the feedback data increases unevenness of vibrationand speed. Therefore the current position data θ(T_(n)) is entered intoa subtractor 12 of the motor drive unit 2 and used for position control.

A speed feedback value is generated by dividing the predicted positionchange Δθ(T_(n) +T_(d)) in the sampling cycle at time T_(n) +T_(d) bythe sampling cycle T0 in a divider 31 and is used for speed control.Thus, data which is free from the delay time is used in thehigh-loop-gain speed control to prevent deterioration of the controlperformance. Though a 3-phase PWM voltage generating means 18 (which isvoltage generating means) and a 3-phase AC→d-q axis converter 20 (whichis conversion means) are not affected by a slight position error anduneven results of detection, a large deviation of position due to thedelay time will incur a reduction of the motor torque, and, therefore,the predicted position data θ(T_(n) +T_(d)) at time T_(n) +T_(d) freefrom the delay time is used.

A data processing timing chart of the encoder unit according to thepresent invention is shown in FIG. 2. Though the operation timings ofall blocks are the same as those in the conventional example shown inFIG. 23, the data to be outputted is the position data at time T_(n)+T_(d) when data output is completed and a delay time is eliminated.

First Embodiment

The first through sixth embodiments show internal embodiments of theoutput compensation unit 11. Since these embodiments are intended tosolve the problems of the conventional delay time compensation method,the overall configuration of the encoder unit can be the above-describedconfiguration illustrated in FIG. 1 or a configuration which outputsonly the position data θ(T_(n) +T_(d)) which is compensated for thedelay time as shown in FIG. 4.

FIG. 5 is a configuration diagram showing an output compensation unit ofan encoder unit according to the first embodiment of the presentinvention. In FIG. 5, the subtractor 21A outputs a difference betweenthe current sampling position θ(T_(n)) and the preceding samplingposition θ(T_(n-1)); that is, a position change Δθn during the currentsampling cycle. The subtractor 21B outputs a difference between thepreceding sampling position θ(T_(n-1)) and a sampling position precedingthe preceding sampling position (at the time n-2) θ(T_(n-2)), that is, aposition change Δθ(n-1) in the preceding sampling cycle. The smaller ofΔθn and Δθ(n-1) is selected by the selector switch 22 as the currentposition change to be entered into the multiplier 23. A position changebetween times T_(n) and T_(n) +T_(d) is obtained by multiplying theselected position change Δθ by T_(d) /T0 (recall that T0 is the samplingtime) in the multiplier 23. Compensation of the delay time is carriedout by adding the output obtained to θ(T_(n)) in the adder 24. Theoperation flow chart of this selector switch 22 is shown in FIG. 7. Ifthe sign of Δθn differs from that of Δθ(n-1), Δθ=0 is given and, iftheir signs are the same, the smaller absolute value is regarded as Δθ.

In this embodiment, an output position when the position moves from astate of staying nearby the detection border across the border as shownin FIG. 30 is shown in FIG. 10. Because of Δθn=1 and Δθ(n-1)=0 at timeT_(n), Δθn=0 is selected by the switch 22. Accordingly, outputθ(T_(n+1))=θ(T_(n))=1 is obtained. Similarly, θ(T_(n+2))=θ(T_(n+1))-0 isgiven, an incorrect output is fed back to the motor drive unit 2 asshown in FIG. 31 to prevent vibration of the motor from increasing. Thebehavior in low speed movement is such that the position output issmoothed to prevent increasing of the speed ripple in rotation of motoras shown in FIG. 12.

Thus, according to the first embodiment, the encoder output compensationmeans predicts a position change which occurs during the delay timerequired for sampling analog signals and outputting the position data,by selecting the smaller of the absolute values of the position changeobtained in the current sampling and the position change obtained in thepreceding sampling. The calculation is performed using the assumptionthat the position change in the sampling cycle linearly or curvilinearlychanges in accordance with the selected position change. By compensatingthe position data in this manner, more accurate output position data isobtained.

Second Embodiment

FIG. 6 is a configuration diagram showing an output compensation unit ofan encoder unit according to a second embodiment of the presentinvention. In FIG. 6, the description of the same components as those ofthe output compensation unit of the first embodiment shown in FIG. 5 isomitted. The switch 22A selects the current position change Δθ as theswitch 22 of the output compensation unit of the first embodiment. Thesubtractor 25A outputs a difference Δ(Δθn) between the position changeΔθn in the current sampling cycle and the position change Δθ(n-1) in thepreceding cycle. The subtractor 25B outputs a difference Δ(Δθn-1)between the position change Δθ(n-1) in the preceding sampling cycle andthe position change Δθ(n-2) in the n-2 sampling cycle. The switch 22Bselects the smaller of Δ(Δθn) and Δ(Δθn-1) as Δ(Δθn) according to theflow chart shown in FIG. 7 (i.e., switch 22B operates in the samemanner, with respect to its inputs, as switch 22 of the firstembodiment). A sum of the selected position change Δθ and the incrementΔ(Δθ) of the position change is multiplied by T_(d) /T0 in themultiplier 23 to obtain a position change between T_(n) and T_(n)+T_(d). The delay time is compensated by adding the output thereof toθ(T_(n)) in the adder 24.

In this embodiment, an output position when the position moves from astate of staying nearby the detection border across the border as shownin FIG. 30 is shown in FIG. 10. Because of Δθn=1 and Δθ(n-1)=0 at timeT_(n), Δθn=0 is selected by the switch 22 and, because of Δ(Δθn)=1 andΔ(Δθn-1)=0, Δ(Δθ)=0 is selected by the switch 22B. Accordingly, outputθ(T_(n+1))=1 is obtained. Similarly, θ(T_(n+2))=0 is given, an incorrectoutput is fed back to the motor drive unit 2 as shown in FIG. 32 toprevent vibration of the motor from increasing. The behavior in lowspeed movement is such that the position output is smoothed to preventincreasing of the speed ripple in rotation of motor as shown in FIG. 12.

Thus, according to the second embodiment, the encoder outputcompensation means predicts a position change which occurs during thedelay time required for sampling analog signals and outputting positiondata, by selecting the smaller of the absolute values of the positionchange in the current sampling cycle and the position change in thepreceding sampling cycle and the smaller of a difference between theposition change in the current sampling cycle and the position change inthe preceding sampling cycle and a difference between the positionchange in the preceding sampling cycle and the position change in then-2 sampling cycle. The calculation is performed under the assumptionthat the position change in the sampling cycle linearly or curvilinearlychanges in accordance with a sum of the differences between selectedposition changes. By compensating the position data in this manner, moreaccurate output position data is obtained.

Third Embodiment

FIG. 8 is a configuration diagram showing an output compensation unit ofan encoder unit according to a third embodiment of the presentinvention. The subtractor 21 outputs a difference between the currentsampling position θ(T_(n)) and the n-2 sampling position θ(T_(n-2));that is, a position change 2Δθ in two sampling cycles and enters it intothe adder 23. An average position change of two sampling cycles isderived by multiplying by 1/2 in the multiplier 23 and simultaneously aposition change between T_(n) and T_(n) +T_(d) is obtained bymultiplying the output by T_(d) /T0. The delay time is compensated byadding the output thereof to θ(T_(n)) in the adder 24.

In this embodiment, an output position when the position moves from astate of staying nearby the detection border across the border as shownin FIG. 30 is shown in FIG. 10. The output at time T_(n) is 2Δθn=1 andthe output θ(T_(n+1))=1 is obtained by deleting the fraction of the meanvalue and adding it to θ(T_(n)). Similarly, θ(T_(n+2))=0 is given, andan incorrect output is fed back to the motor drive unit 2 as shown inFIG. 31 to prevent vibration of the motor from increasing. The behaviorin low speed movement is such that the position output is smoothed toprevent increasing of the speed ripple in rotation of motor as shown inFIG. 13.

Thus, according to the third embodiment, the encoder output compensationmeans predicts a position change which occurs during the delay timerequired for sampling analog signals and outputting position data, byassuming that the position change linearly or curvilinearly changes inaccordance with a mean value of a position change in the currentsampling cycle and a position change in the preceding sampling cycle. Bycompensating the position data in this manner, more accurate outputposition data is obtained.

Fourth Embodiment

FIG. 9 is a configuration diagram showing an output compensation unit ofan encoder unit according to a fourth embodiment of the presentinvention. The subtractor 21D performs the same operation as thesubtractor 21 of the output compensation unit of the previous embodimentand outputs the position change 2Δθ in two sampling cycles. Thesubtractor 21A outputs the position change Δθn in the current samplingcycle, the subtractor 21C outputs the position change Δθ(n-2), andsubtractor 25 outputs a variation component 2Δ(Δθ) of the positionchange in two sampling cycles. 2Δθ and 2Δ(Δθ) are added in the adder 26and entered into the multiplier 23. An average position change and thevariation component of the position change of two sampling cycles arederived by multiplying the output by 1/2 in the multiplier 23 andsimultaneously a position change between T_(n) and T_(n) +T_(d) isobtained by multiplying the output by T_(d) /T0. The delay time iscompensated by adding the output thereof to θ(T_(n)) in the adder 24.

In this embodiment, an output position when the position moves from astate of staying nearby the detection border across the border as shownin FIG. 30 is shown in FIG. 11. 2Δθ=1 and 2Δ(Δθ)=1 at time T_(n) areadded to the mean value θ(T_(n+1)) to obtain θ(T_(n+1))=2. Similarly,θ(T_(n+2))=0 is given, and an incorrect output is fed back to the motordrive unit 2 as in the conventional example shown in FIG. 32 to preventvibration of the motor from increasing. The behavior in low speedmovement is such that the position output is smoothed to preventincreasing of the speed ripple in rotation of motor as shown in FIG. 13.

Thus, according to the fourth embodiment, the encoder outputcompensation means predicts a position change which occurs during adelay time required for sampling analog signals and outputting positiondata, by assuming that the position change linearly or curvilinearlychanges in accordance with a sum of the mean value of the positionchanges obtained from the position changes in the current and precedingsampling cycles and a mean value of the differences of position changesin the preceding and the n-2 sampling cycles. By compensating theposition data in this manner, more accurate output position data isobtained.

Fifth Embodiment

FIG. 14 is a configuration diagram showing an output compensation unitof an encoder unit according to a fifth embodiment of the presentinvention. The description of the same component as those of the outputcompensation unit shown in FIG. 28 is omitted. Reference numerals 27 isa second multiplier which multiplies the output of the multiplier 23 byK(Δθn) and the output thereof is added to θ(T_(n)) by the adder 24 tocompensate the delay time. In this case, the multiplier 27 is a variablemultiplier for which the magnification K(Δθn) is varied with the valueof Δθn. This multiplier K(Δθn) is set to be large when the positionchange during the sampling interval is large and to be small when theposition change during the sampling interval is small. In other words,by additionally providing this variable multiplier, the magnification ofcompensation is set to be small for low speed operation in which theeffect of the delay time is small and a slight detection error mayadversely affect the control loop to increase vibration and speedunevenness, and to be large for high speed operation in which the effectof the delay time is large and a slight detection error rarely adverselyaffects the control loop. Therefore, such problems as the increase ofvibration due to the conventional delay time compensation will be solvedwhile simultaneously solving a problem due to the delay time.

FIGS. 15 and 16 are respectively a graph showing an operation example ofthe variable multiplier 27, and the magnification 0 to 1 can becontinuously varied in reference to Δθ as shown in FIG. 15 or can bechanged over in a plurality of steps as two steps or more as shown inFIG. 16. Though the predicting of the position has been described in thefirst through fifth embodiments on the assumption that the positionlinearly changes, the configuration can be made so that the positioncurvilinearly changes.

Thus, according to the fifth embodiment, the encoder output compensationmeans predicts a position change which occurs during the delay timerequired for sampling analog signals and outputting position data, basedon the position data obtained in the current and preceding and earliersampling cycles. The encoder output compensation means is provided witha variable multiplier to obtain more accurate position output byreducing the predicted position change when the position change in thecurrent sampling cycle is small.

Sixth Embodiment

FIG. 17 is a configuration diagram showing an encoder unit and a servomotor control unit according to a sixth embodiment of the presentinvention. The common components of the encoder unit and the servo motorcontrol unit to those according to the embodiment 1 shown in FIG. 1 aregiven the same reference numerals and the description thereof isomitted. Reference numeral 28 denotes a Δ(Δθ)-Iq function estimationunit which obtains a variation Δ(Δθ) of the position change from thesampling position data θ(T_(n)) and the two preceding sampling positiondata θ(T_(n-1)) and θ(T_(n-2)) which are stored in the storage unit 10.The Δ(Δθ)-Iq function estimation unit estimates a function between thecurrent value Iq outputted from the motor drive unit and the variationA(Δθ) as given below.

    Δ(Δθ)=f(Iq)

A function which represents a substantially average gradient of therelationship between Δ(Δθ) sampled as shown in FIG. 18 and Iq isestimated. The function estimation unit 28 outputs the variation Δ(Δθ)of the current position change from Iq based on the estimated function.A sum of θ(T_(n))-θ(T_(n-1))=Δθ and the output Δ(Δθ) of the functionestimation unit 28 is outputted by the adder/subtractor 29 and theposition change during the delay time T_(d) is obtained by multiplyingthe output thereof by T_(d) /T0. The position change obtained is addedto θ(T_(n)) by the adder 24 to compensate the delay time. The functionto be estimated by the function estimation unit 28 may be a quadratic orhigher order function.

Thus, according to the sixth embodiment, the encoder output compensationmeans evaluates in advance a relationship between a value of the currentto be outputted from the motor drive unit and a degree of variation ofthe position change in the sampling cycle, the position change whichoccurs during the delay time is predicted from the evaluatedrelationship, the present current value and position data. Bycompensating the position data in this manner, more accurate outputposition data is obtained.

Seventh Embodiment

FIG. 19 is a configuration diagram showing an encoder unit according toa seventh embodiment of the present invention. In FIG. 19, those commoncomponents to the encoder unit shown in FIG. 1 are given the samereference numerals and the description thereof is omitted. An LEDcomprises 4A and 4B and light receiving devices 6C and 6D are added. Thepatterns of the shield plate 5 are formed in parallel for generatinganalog signals and pulse train signals as shown in FIG. 20. In FIG. 20,the shaded part shields the light. Analog signals to be outputted fromthe light receiving devices 6A and 6B are converted to position dataθ(T_(n)) which will be processed as in the conventional example. Thepulses of pulses trains A and B to be outputted from the light receivingdevices 6C and 6D have a phase difference of 90° and are counted by theup/down counter 30. FIG. 21 shows data processing timings of the encoderunit shown in FIG. 19. The up/down counter 30 is cleared to zero at thesame time as the sample-and-hold circuits 7A and 7B hold the samplingdata and subsequently counts pulses A and B. The A/D conversion time andthe arithmetic processing time T_(d) are compensated by adding the countnumber Δθ(T_(d)) of the counter 30 during time T_(d) up to completion ofarithmetic processing of the arithmetic unit 9 to the output of thearithmetic unit 9 in the adder 24. The configuration as described aboveenables to output those data free from the delay time. A position changefor a time required for serial output can be estimated from Δθ(T_(d))and the position change in the communication time can be compensated.

Thus, according to the seventh embodiment, the encoder unit, whichsamples analog signals in accordance with a rotation angle of therevolving shaft and obtains the rotation angle of the revolving shaftfrom converted digital data, is provided with: pulse signal generatingmeans for generating two pulse trains having pulses whose phases areoffset by 90° relative to each other; a counter for counting a number ofpulses of the pulse trains to measure a delay rotation angle throughwhich said shaft rotates during a time period required for the A/Dconverter to sample the analog signals and for the arithmetic operationmeans to determine the rotation angle; and encoder output compensationmeans for outputting a current angle as a sum of the rotation angle andthe delay rotation angle. The encoder unit can accurately compensate forthe delay time required for A/D conversion and arithmetic processing,regardless of the behavior of the motor speed and the acceleration, andthe increase of delay time of the control loop and the error of magneticpole detection can be eliminated.

As described above, a servo control unit according to the presentinvention comprises an encoder unit for sampling analog signals inaccordance with a position of a detection object and obtaining positiondata from converted digital data. The encoder unit includes an encoderoutput compensation unit which predicts a position change of thedetection object during the delay time required for sampling the analogsignals and outputting the position data. The encoder outputcompensation unit uses the position data obtained from the currentsampling and the position data obtained from preceding samplings, andoutputs the predicted position change as well as accurate position dataobtained by adding the predicted position change to the position dataobtained from the current sampling. The encoder output compensation unitalso provides as an output the position data obtained from the currentsampling (uncompensated). Since, in the present invention, it isacceptable for the delay time required for A/D conversion, arithmeticprocessing and communication to be relatively long, low cost A/Dconversion means and arithmetic operation means can be used. Arithmeticoperation means and output compensation means can be realized with acentral processing unit (CPU) and a micro processor unit (MPU),respectively; therefore, the cost increase of the output compensationmeans can be offset. In addition, for example, communication with themotor drive unit need not be speeded up excessively.

The servo motor control unit according to the present invention furthercomprises: a motor drive unit for driving the servo motor which isprovided with position control means; speed control means; conversionmeans; current control means and voltage control means. A speed commandvalue is generated by the position control means with a low loop gain inaccordance with a difference between the position command value and thecurrently sampled position data the encoder unit outputs. A commandvalue of the current is generated by the speed control means with a highloop gain in accordance with a difference between a speed command valueand the speed feedback value obtained from the predicted position changeoutput by the encoder unit. A 3-phase alternating current detected fromthe servo motor is converted to a torque component current, usingpredicted position data. The voltage command value is generated inaccordance with a difference between a current command value and afeedback value of the current (the torque component current) (forconversion in response to the current magnetic pole position when theservo motor is a synchronous motor) entered by the conversion means. A3-phase voltage is generated in response to the current magnetic poleposition in accordance with the voltage command value and the predictedposition data. Therefore, the servo motor can be accurately controlledwithout any increase of vibration and speed unevenness of the servomotor.

What is claimed is:
 1. An encoder unit, comprising:signal generatingmeans for generating analog signals in accordance with a position of adetected object; A/D conversion means for sampling the analog signalsand converting the analog signals to digital data; arithmetic operationmeans for generating position data of the detected object from thedigital data; and encoder output compensating means which uses theposition data obtained from current sampling and preceding samplings topredict a position change of the detected object occurring during adelay time required for sampling the analog signals and outputting theposition data, said encoder output compensation means generatingpredicted position data by adding the predicted position change tocurrently sampled position data, wherein said encoder outputcompensation means predicts the predicted position change by selectingthe smaller of an absolute value of a position change occurring during acurrent sampling cycle and an absolute value of a position changeoccurring during a preceding sampling cycle, and by assuming thatposition changes occurring during sampling cycles are linear orcurvilinear in accordance with the selected position change.
 2. Anencoder unit, comprising:signal generating means for generating analogsignals in accordance with a position of a detected object; A/Dconversion means for sampling the analog signals and converting theanalog signals to digital data; arithmetic operation means forgenerating position data of the detected object from the digital data;and encoder output compensating means which uses the position dataobtained from current sampling and preceding samplings to predict aposition change of the detected object occurring during a delay timerequired for sampling the analog signals and outputting the positiondata, said encoder output compensation means generating predictedposition data by adding the predicted position change to currentlysampled position data, wherein said encoder output compensation meanspredicts the predicted position change by selecting the smaller of anabsolute value of a position change occurring during a current samplingcycle and an absolute value of a position change occurring during apreceding sampling cycle, and by selecting the smaller of a differencebetween a position change occurring during the current sampling cycleand a position change occurring during the preceding sampling cycle anda difference between the position change occurring during the precedingsampling cycle and a position change occurring during a sampling cyclepreceding the preceding sampling cycle, and by assuming that positionchanges occurring during sampling cycles are linear or curvilinear inaccordance with a sum of the selected position change and the selecteddifference between position changes.
 3. An encoder unit,comprising:signal generating means for generating analog signals inaccordance with a position of a detected object; A/D conversion meansfor sampling the analog signals and converting the analog signals todigital data; arithmetic operation means for generating position data ofthe detected object from the digital data; and encoder outputcompensating means which uses the position data obtained from currentsampling and preceding samplings to predict a position change of thedetected object occurring during a delay time required for sampling theanalog signals and outputting the position data, said encoder outputcompensation means generating predicted position data by adding thepredicted position change to currently sampled position data, whereinsaid encoder output compensation means predicts the predicted positionchange by assuming that position changes occurring during samplingcycles are linear or curvilinear in accordance with a mean value of aposition change occurring during a current sampling cycle and a positionchange occurring during a preceding sampling cycle.
 4. An encoder unit,comprising:signal generating means for generating analog signals inaccordance with a position of a detected object; A/D conversion meansfor sampling the analog signals and converting the analog signals todigital data; arithmetic operation means for generating position data ofthe detected object from the digital data; and encoder outputcompensating means which uses the position data obtained from currentsampling and preceding samplings to predict a position change of thedetected object occurring during a delay time required for sampling theanalog signals and outputting the position data, said encoder outputcompensation means generating predicted position data by adding thepredicted position change to currently sampled position data, whereinsaid encoder output compensation means predicts the predicted positionchange by assuming that position changes occurring during samplingcycles are linear or curvilinear in accordance with a sum of: a meanvalue of a position change occurring during a current sampling cycle anda position change occurring during a preceding sampling cycle; and amean value of a difference between the position change occurring duringthe current sampling cycle and the position change occurring during thepreceding sampling cycle and a difference between the position changeoccurring during the preceding sampling cycle and a position changeoccurring during a sampling cycle preceding the preceding samplingcycle.
 5. An encoder unit, comprising:signal generating means forgenerating analog signals in accordance with a position of a detectedobject; A/D conversion means for sampling the analog signals andconverting the analog signals to digital data; arithmetic operationmeans for generating position data of the detected object from thedigital data; and encoder output compensating means which uses theposition data obtained from current sampling and preceding samplings topredict a position change of the detected object occurring during adelay time required for sampling the analog signals and outputting theposition data, said encoder output compensation means generatingpredicted position data by adding the predicted position change tocurrently sampled position data, wherein said encoder outputcompensation means predicts the predicted position change from positiondata obtained from a current sampling cycle and preceding samplingcycles, and comprises a variable multiplier which reduces the predictedposition change when a position change in the current sampling cycle issmall.
 6. An encoder unit, comprising:signal generating means forgenerating analog signals in accordance with a position of a detectedobject; A/D conversion means for sampling the analog signals andconverting the analog signals to digital data; arithmetic operationmeans for generating position data of the detected object from thedigital data; and encoder output compensating means which uses theposition data obtained from current sampling and preceding samplings topredict a position change of the detected object occurring during adelay time required for sampling the analog signals and outputting theposition data, said encoder output compensation means generatingpredicted position data by adding the predicted position change tocurrently sampled position data, wherein said encoder outputcompensation means evaluates in advance a relationship between a currentvalue to be outputted from a motor drive unit and a degree of variationin position changes in sampling cycles, and predicts the predictedposition change based upon the evaluated relationship and a presentcurrent value and position data.
 7. An encoder unit, comprising:signalgenerating means for generating analog signals corresponding to arotation angle of a revolving shaft; A/D conversion means for samplingsaid analog signals and converting said analog signals to digital data;arithmetic operation means for determining a rotation angle of saidrevolving shaft from the digital data; pulse signal generating means forgenerating two pulse trains having pulses whose phases are offset by 90°relative to each other; a counter for counting a number of said pulsesof said pulse trains to measure a delay rotation angle through whichsaid shaft rotates during a time period required for said A/D convertingmeans to sample said analog signals and for said arithmetic operationmeans to determine said rotation angle; and encoder output compensationmeans for outputting a current angle as a sum of said rotation angle andsaid delay rotation angle.